package com.common.converter;

import com.common.entity.personal.PersonalEntity;
import com.common.requestvo.judicialpersonal.JudicialPersonalReqVo;
import com.common.vo.judicialpersonal.JudicialPersonalVo;
import org.mapstruct.Mapper;
import org.mapstruct.Mapping;
import org.mapstruct.Mappings;
import org.mapstruct.factory.Mappers;

/**
 * @author johnny
 * @create 2020-07-13 下午5:04
 **/
@Mapper
public interface PersonalInfoConverter {

    PersonalInfoConverter INSTANCE = Mappers.getMapper(PersonalInfoConverter.class);

    @Mappings({
            @Mapping(source = "createTime", target = "createTime", dateFormat = "yyyy-MM-dd HH:mm:ss"),
            @Mapping(source = "updateTime", target = "updateTime", dateFormat = "yyyy-MM-dd HH:mm:ss"),
            @Mapping(source = "birthday", target = "birthday", dateFormat = "yyyy-MM"),
            @Mapping(source = "timeToJoinPart", target = "timeToJoinPart", dateFormat = "yyyy-MM"),
            @Mapping(source = "timeToProcurator", target = "timeToProcurator", dateFormat = "yyyy-MM"),
            @Mapping(source = "timeToWork", target = "timeToWork", dateFormat = "yyyy-MM"),
    })
    JudicialPersonalVo domain2vo(PersonalEntity personalEntity);

    @Mappings({
            @Mapping(source = "createTime", target = "createTime", dateFormat = "yyyy-MM-dd HH:mm:ss"),
            @Mapping(source = "updateTime", target = "updateTime", dateFormat = "yyyy-MM-dd HH:mm:ss"),
            @Mapping(source = "birthday", target = "birthday", dateFormat = "yyyy-MM"),
            @Mapping(source = "timeToJoinPart", target = "timeToJoinPart", dateFormat = "yyyy-MM"),
            @Mapping(source = "timeToProcurator", target = "timeToProcurator", dateFormat = "yyyy-MM"),
            @Mapping(source = "timeToWork", target = "timeToWork", dateFormat = "yyyy-MM"),
    })
    PersonalEntity vo2domain(JudicialPersonalVo judicialPersonalVo);
}